﻿using MongoDB.Driver;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Colorful.Models
{
    #region 案例展示
    public class CaseDataSource : IDataSource
    {
        private List<JsonData<string>> _datas;
        public List<JsonData<string>> Datas
        {
            get
            {
                if (_datas == null)
                {
                    //using (var db = WebConfig.GetMongodb())
                    //{
                    //    _datas = db.Codes.Where(a => a.MenuId == (long)CodeEnum.Cases).Select(a => new { a.Id, a.Name }).ToList().Select(a => new JsonData<string>() { id = a.Id.ToString(), text = a.Name }).ToList();
                    //}
                }
                return _datas;
            }
        }
    }
    #endregion
}
